Repository navigation
Keep Kibana's dashboards through a snapshot restore and a rebuild (S-024-10, S-024-11) - #613
Conversation
…024-10, S-024-11) S-012's snapshots already hold every feature state; with a Kibana service reading the cluster, the backup script now also checks that the snapshot it took lists the feature state kibana and fails the run when it does not, so a backup that would not bring the dashboards back is never reported as one that does. The snapshot request is unchanged, and the script of a cluster without Kibana renders byte-identical. The new Kibana service guide gives the restore (stop Kibana, restore the feature state kibana alone, start Kibana) and what a rebuilt Kibana server gets: the store's three encryption keys, never new ones, and a new token in the rebuilt node's own service_tokens file. Tests prove both on stand-ins. Fixes #580 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Spec 024 gives Kibana no backup of its own: the S-012 snapshot already asks for the cluster state and every feature state. Failing cloudfall backup run when a declared Kibana's feature state is missing, also for a Kibana that never started, went beyond the spec, so the backup script, the role's variables and services.yml are back to main's. S-024-10 is now proved by the snapshot request asking for every feature state and the taken snapshot listing kibana on a node that has it; the guide and the changelog follow. Part of #580 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Verdict: MERGE. Reviewed inline by the landing session at head 6520df9; no fix commits.
After the revision the PR has no engine or SDK code: the guide docs/kibana-service-guide.md (restore and rebuild sections), a changelog fragment, two new test files, and an opt-in feature_states field on S-012's fake node.
Checked:
- The restore body
{"indices": "-*", "include_global_state": false, "feature_states": ["kibana"]}is Elastic's documented way to restore one feature state alone; Kibana is stopped first and started after (spec 024, Saved objects and backups) - The guide uses the
cloudfallaccount with curl prompting for the password;elasticstays break-glass and unused (spec 024) - S-012's snapshot request is unchanged, and the test asserts it carries no
feature_stateslist (every feature state) - S-024-11: the keys come from the store, are never generated on the server, and a rebuilt empty host gets the same three keys and a new token; a second converge changes nothing
- The S-012 fake's new field defaults to empty, so S-012's tests are unchanged
Tests run locally: pytest on engine/tests/test_s024_10_11_kibana_dashboards.py, engine/tests/test_s012_elasticsearch_snapshots.py and sdk/tests/test_s024_11_kibana_rebuild_keys.py: 36 passed. The implementer ran ruff, mypy, ansible-lint and config validate. Full suite left to CI.
Unverified live: a real snapshot listing kibana, the restore bringing back a deleted dashboard, and analyst opening it after a rebuild.
Findings not fixed:
- F-1 nit: the guide covers only backup, restore and rebuild; the spec's other guide sections come with #582
Plan
docs/kibana-service-guide.md(new),engine/tests/test_s024_10_11_kibana_dashboards.py(new),sdk/tests/test_s024_11_kibana_rebuild_keys.py(new),engine/tests/test_s012_elasticsearch_snapshots.py,changelog.d/580-kibana-dashboards-survive.mdservices.ymlstay as on main: the kind has no backup of its ownfeature_stateslist (every feature state), and the snapshot it took is listed with the feature statekibanaon a node that has it; the guide's three restore commands parsed and checked against the restore API's body. S-024-11: the Kibana role's keystore tasks run for real on a converged host and then on a rebuilt empty one (same three keys from the store, new token, second convergechanged=0), and the controller staging the store's keys on every converge while the store never replaces a held keyengine/tests/test_s012_elasticsearch_snapshots.py: its fake node gainsfeature_states, listed on a new snapshot only when a test sets them, so the S-024-10 tests can list a snapshot as a node with Kibana does; S-012's own tests are unchanged and still passSummary
Builds S-024-10 and S-024-11 of spec 024: Kibana's dashboards survive a feature-state restore and a rebuilt server. No engine or SDK code changes: what the spec asks already holds on main, and this PR documents and proves it.
kibanain every snapshot (S-024-10): S-012's snapshot asks for the cluster state (include_global_state: true) with nofeature_stateslist, which Elasticsearch takes as every feature state, so once Kibana has started against the cluster each snapshot listskibana. The request stays exactly as it is (namingkibanawould drop the other feature states), and S-012's restore drill (renamed copies of data indices,include_global_state: false) is untouched. As the spec says, the kind has no backup of its own, socloudfall backup runadds no Kibana checkdocs/kibana-service-guide.mdgives them as the spec says:systemctl stop kibana.service,POST /_snapshot/cloudfall/<snapshot>/_restorewith{"indices": "-*", "include_global_state": false, "feature_states": ["kibana"]}(no data index, no cluster state, Kibana's system indices replaced by the snapshot's),systemctl start kibana.service. It also shows how to read a snapshot's feature states, and asks for thecloudfallpassword interactively rather than putting it on the command lineelastic/kibanatoken in its ownservice_tokensfile; the old token lived only in the old node's file, so it is valid nowhere once the server is rebuilt (the spec: "a rebuilt server gets a new one")The guide holds these sections only; its status line says the others the spec lists (declaration, users, Domain, SSH forward, version change, licences) come later.
Test notes
engine/tests/test_s024_10_11_kibana_dashboards.py(5 tests): S-012's rendered backup script against the fake node, its snapshot request carrying nofeature_stateslist, and the taken snapshot read back withGET /_snapshot/cloudfall/<name>listingkibanaandsecurity; the guide's stop, restore and start commands in order, the restore URL and its JSON body; and the Kibana role'skeystore.ymlrun for real withansible-playbookon a first host and on a rebuilt empty one: the rebuilt keystore holds the store's three keys (the same as the first host's), a new token in the rebuilt node'sservice_tokens, no secret in the-vvv --diffoutput, and a second convergechanged=0sdk/tests/test_s024_11_kibana_rebuild_keys.py(2 tests): two converges stage the same three key values from the store and leave the store file byte-identical; the store refuses to generate over each held keyspecs.py coverage --spec 024lists tests for S-024-10 and S-024-11ruff check .,mypy,ansible-lint engine/ansible(withANSIBLE_CONFIG=engine/ansible/ansible.cfg, as CI),cloudfall config validate --project config/examples, andpyteston the new files plusengine/tests/test_s012_elasticsearch_snapshots.py. The full suite is left to CIUnverified live (needs Debian 13 hosts with Elastic's packages):
feature_stateswithkibana, and the guide's restore bringing back a deleted dashboard of S-024-6analystlogging in and the dashboard of S-024-6 opening, with saved objects encrypted before the rebuild still decryptingkibana.servicestarting cleanly after its system indices were replaced by the restoreFixes #580
🤖 Generated with Claude Code